package com.atomscat.lottery.controller.admin;


import com.atomscat.lottery.entity.db.UserEntity;
import com.atomscat.lottery.entity.vo.request.CreateAdminUserRequest;
import com.atomscat.lottery.entity.vo.response.BaseResponse;
import com.atomscat.lottery.service.UserEntityService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin")
@RequiredArgsConstructor
public class UserController {

    private final UserEntityService userEntityService;

    /**
     * Search for users by their first name.
     *
     * @param username the first name of the user to search for
     * @return a list of users with the specified first name
     */
    @GetMapping("/users/search")
    public BaseResponse<List<UserEntity>> searchUserByFirstName(@RequestParam(required = false) String username) {
        return userEntityService.searchUserByFirstName(username);
    }

    /**
     * Create a new user.
     * @param createAdminUserRequest
     * @return
     */
    @PostMapping("/users/create")
    public BaseResponse<Long> createUser(@Valid @RequestBody CreateAdminUserRequest createAdminUserRequest) {
        return userEntityService.createAdminUser(createAdminUserRequest);
    }

    // reset password

}
